package com.ymttest.database.mapping;

import static org.apache.ibatis.jdbc.SqlBuilder.BEGIN;
import static org.apache.ibatis.jdbc.SqlBuilder.INSERT_INTO;
import static org.apache.ibatis.jdbc.SqlBuilder.SET;
import static org.apache.ibatis.jdbc.SqlBuilder.SQL;
import static org.apache.ibatis.jdbc.SqlBuilder.UPDATE;
import static org.apache.ibatis.jdbc.SqlBuilder.VALUES;
import static org.apache.ibatis.jdbc.SqlBuilder.WHERE;

import com.ymttest.database.model.MarkupConfig;

public class MarkupConfigSqlProvider {

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table markupconfig
     *
     * @mbggenerated Wed Apr 08 16:33:08 CST 2020
     */
    public String insertSelective(MarkupConfig record) {
        BEGIN();
        INSERT_INTO("markupconfig");
        
        if (record.getAgentId() != null) {
            VALUES("agentId", "#{agentId,jdbcType=INTEGER}");
        }
        
        if (record.getSupplierId() != null) {
            VALUES("supplierId", "#{supplierId,jdbcType=INTEGER}");
        }
        
        if (record.getMarkupType() != null) {
            VALUES("markupType", "#{markupType,jdbcType=INTEGER}");
        }
        
        if (record.getPercentage() != null) {
            VALUES("percentage", "#{percentage,jdbcType=DECIMAL}");
        }
        
        if (record.getDecimalType() != null) {
            VALUES("decimalType", "#{decimalType,jdbcType=INTEGER}");
        }
        
        if (record.getOnSaleType() != null) {
            VALUES("onSaleType", "#{onSaleType,jdbcType=INTEGER}");
        }
        
        if (record.getRefreshProduct() != null) {
            VALUES("refreshProduct", "#{refreshProduct,jdbcType=BIT}");
        }
        
        if (record.getConfigStatus() != null) {
            VALUES("configStatus", "#{configStatus,jdbcType=INTEGER}");
        }
        
        if (record.getCreateTime() != null) {
            VALUES("createTime", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateTime() != null) {
            VALUES("updateTime", "#{updateTime,jdbcType=TIMESTAMP}");
        }
        
        return SQL();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table markupconfig
     *
     * @mbggenerated Wed Apr 08 16:33:08 CST 2020
     */
    public String updateByPrimaryKeySelective(MarkupConfig record) {
        BEGIN();
        UPDATE("markupconfig");
        
        if (record.getMarkupType() != null) {
            SET("markupType = #{markupType,jdbcType=INTEGER}");
        }
        
        if (record.getPercentage() != null) {
            SET("percentage = #{percentage,jdbcType=DECIMAL}");
        }
        
        if (record.getDecimalType() != null) {
            SET("decimalType = #{decimalType,jdbcType=INTEGER}");
        }
        
        if (record.getOnSaleType() != null) {
            SET("onSaleType = #{onSaleType,jdbcType=INTEGER}");
        }
        
        if (record.getRefreshProduct() != null) {
            SET("refreshProduct = #{refreshProduct,jdbcType=BIT}");
        }
        
        if (record.getConfigStatus() != null) {
            SET("configStatus = #{configStatus,jdbcType=INTEGER}");
        }
        
        if (record.getCreateTime() != null) {
            SET("createTime = #{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateTime() != null) {
            SET("updateTime = #{updateTime,jdbcType=TIMESTAMP}");
        }
        
        WHERE("agentId = #{agentId,jdbcType=INTEGER}");
        WHERE("supplierId = #{supplierId,jdbcType=INTEGER}");
        
        return SQL();
    }
}